Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

371
Visualizações
Nashhorn engine fails on Java 11 with "unknown call type" error

I have a JS script which is failing when evaluated using Nashorn engine from Java. This code works fine on Java 8 but fails on Java 11. I am getting an error:

unknown call type GET:PROPERTY|ELEMENT|METHOD:NODE_PATH(Object)int@jdk.nashorn.internal.scripts.Script$Recompilation$20$11678$\^eval\_
   java.lang.AssertionError: unknown call type GET:PROPERTY|ELEMENT|METHOD:NODE_PATH(Object)int@jdk.nashorn.internal.scripts.Script$Recompilation$20$11678$\^eval\_
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.linker.NashornBottomLinker.linkBean(NashornBottomLinker.java:126)
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.linker.NashornBottomLinker.getGuardedInvocation(NashornBottomLinker.java:78)
     at jdk.dynalink/jdk.dynalink.linker.support.CompositeGuardingDynamicLinker.getGuardedInvocation(CompositeGuardingDynamicLinker.java:109)

The code is:

function __toCall() {
return require('nashorn-invoker')(
    function (require) {
        var Text = function Text() {
            StringLeaf.call(this);
        };
        extend(Text, StringLeaf);
        Text.prototype.ontologyType = function () {
            return 'cmd.ontology.types.Text';
        };

        var BasicTest = function BasicTest() {
            var _field = new Text();
            _field._fieldName = 'field';
            _field._name = 'Field';
            _field._defaultValue = '';

            var curNode = this;
            Structure.call(this, {
                field: _field
            });
        };
        extend(BasicTest, Structure);
        BasicTest.prototype.ontologyType = function () {
            return 'cmd.ontology.test.BasicTest';
        };
        BasicTest.prototype._name = 'Basic Test';
        return (function () {
            var model = [];
            var callbackFn = function (result) {
                if (result !== true) model.push.apply(model, result);
            };
            test.child('field').validate(vc, callbackFn);
            var result = model.length === 0 ? true : model;
            print('Callback function result: ' + JSON.stringify(result));
            return result;
        })();
    }
);

}

File nashorn-invoker.js

 module.exports = function nashornInvoker(callback) {
      return callback(require); // runs the given callback and provide our "require" context
   };
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Similar problem was answered here.

JS script doesn't run with Java 11 but works with Java 8

This sounds like it could be the JDK-8261926 bug. The good news is that this is fixed, but only in the standalone Nashorn, not the one integrated into Java 11. There's also a page describing how you can ensure that standalone Nashorn is used by your program instead of the integrated one on Java 11.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda